<template>
  <div class="product-list">
    <van-skeleton title :loading="loading" :row="20">
      <van-nav-bar
        title="详情"
        left-text="返回"
        right-text="分享"
        left-arrow
        :fixed="true"
        :placeholder="true"
        @click-left="$router.back(-1)"
        @click-right="$store.state.userInfo.F_Question?showShare = true:$router.push('/login')"
      >
        <!-- <template #right class="share-title">
          <van-icon name="share-o" size="18" @click="showShare = true" />
          
        </template> -->
      </van-nav-bar>
      <!-- <van-swipe class="my-swipe" :autoplay="5000" lazy-render>
        <van-swipe-item v-for="image in item.F_pic_url" :key="image">
          <img :src="image" />
        </van-swipe-item>
      </van-swipe> -->
      <div><img :src="'http://higuang365.com/' + item.F_pic_url" /></div>
      <div class="information">
        <div class="group-warp">
          <div class="module-wrap" id="J_mod3">
            <div class="module-price">
              <div class="real-price">
                <span class="ui-yen"
                  ><i class="price-symbol">¥</i
                  ><span class="price">{{ item.F_Price }}</span></span
                >
                <span class="icon-text">品牌钜惠</span>
              </div>
              <div class="item-price">
                <label>价格:</label>
                <del>¥{{ item.F_Price + 200 }}-{{ item.F_Price + 450 }}</del>
              </div>
            </div>
          </div>
          <div class="module-wrap" id="J_mod4">
            <div class="module-from"></div>
          </div>
          <div class="module-wrap" id="J_mod5">
            <div class="module-title">
              <div class="share-warp">
                <div class="mui-flex">
                  <div class="main cell">
                    {{ item.F_Name }}
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="module-wrap" id="J_mod6">
            <div class="module-adds">
              <!-- <span class="postage">快递: 免运费</span> -->

              <span class="sales">月销量 1万+件</span>

              <div class="delivery" v-if="item.F_yuliu2">
                <img :src="'http://higuang365.com/' + item.F_yuliu2" />
                <div>{{ item.F_BrandCountrie }}</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="gap"></div>
      <van-sticky :offset-top="46">
        <div class="mod_tab">
          <div
            class="J_ping item"
            @click="modtab = 'details'"
            :class="{ cur: modtab === 'details' }"
          >
            商品介绍
          </div>
          <!-- <div
            class="J_ping item"
            @click="modtab = 'Spec'"
            :class="{ cur: modtab === 'Spec' }"
          >
            规格参数
          </div> -->
          <!-- <div
            class="J_ping item"
            @click="modtab = 'Aftersales'"
            :class="{ cur: modtab === 'Aftersales' }"
          >
            售后保障
          </div> -->
        </div>
      </van-sticky>
      <div class="details" v-html="item.F_yuliu4"></div>
      <!-- <img v-for="image in banner" :key="image" :src="image"/> -->
      <!-- <div class="Spec" v-if="modtab === 'Spec'">
        <div><span>品牌：</span>{{ item.brandName }}</div>
        <div><span>重量：</span>{{ item.weight }}</div>
        <div>
          <span>款式：</span
          ><span v-for="Seq in item.salePropSeq" :key="Seq">{{ Seq[0] }}</span>
        </div>
      </div> -->

      <van-action-bar>
        <van-action-bar-icon
          icon="chat-o"
          text="客服"
          color="#ee0a24"
          @click="customer"
        />
        <!-- <van-action-bar-icon icon="cart-o" text="购物车" to="../cart" /> -->
        <!-- <van-action-bar-icon
          :icon="star ? 'star' : 'star-o'"
          :text="star ? '已收藏' : '收藏'"
          color="#ff5000"
          @click="star = !star"
        /> -->
        <!-- <van-action-bar-button
          type="warning"
          text="加入购物车"
          @click="joincart"
        /> -->
            <!-- 'http://www.higuang365.com/index.php/wap/passport-signup.html?parents_id=' + -->
        <a
          :href="
          'http://www.higuang365.com/wap/product-'+
          $route.params.id+'.html'+($route.params.parents_id=='undefined'?
          '':'?parents_id='+$route.params.parents_id)
          "
          style="flex: 1; margin: 2rem"
        >
          <van-action-bar-button type="danger" text="立即购买" />
        </a>
      </van-action-bar>
    </van-skeleton>
    <van-overlay :show="showShare" @click="showShare = false" z-index="100">
      <div class="wrapper" @click.stop>
        <van-icon name="share-o" size="100" @click="showShare = true" />
        <div class="sharetips">分享给你的朋友</div>
        <!-- <img class="block" src="//bpic.588ku.com/element_origin_min_pic/19/04/23/a115a1dee787538a628d0220c42bfc57.jpg"/> -->
      </div>
    </van-overlay>
  </div>
</template>
<script>
import { onMounted, reactive, toRefs, getCurrentInstance } from "vue";
import { useRoute } from "vue-router";
import { Details } from "@/api/home";
import { Toast } from "vant";
import { useStore } from "vuex";
export default {
  name: "product-list",
  setup() {
    const data = reactive({
      banner: [],
      price: 0,
      name: "",
      item: {},
      modtab: "details",
      showShare: false,
      loading: true,
      star: true,
      sharewx: [],
    });
    const route = useRoute();
    const { id } = route.params;

    const customer = () => {
      Toast("客服不在！");
    };
    const { ctx } = getCurrentInstance();

    onMounted(async () => {
      const res = await Details({ goodsid: id });
      data.item = res[1][0];
      data.loading = false;
    });
    return { ...toRefs(data), customer };
  },
};
</script>
<style lang="scss" scoped>
@import "@/common/style/mixin";
.product-list{
    font-size: 1.5rem;
}
.my-swipe {
  height: 100vw;
  img {
    width: 100vw;
    height: 100vw;
  }
}

.information {
  text-align: left;
}
.gap {
  width: 100%;
  height: 1rem;
  background: #f5f5f5;
}
.module-price {
  background-color: #fff;
  padding: 0 10px;
  .real-price {
    color: #ff0036;
    height: 3.6rem;
    line-height: 3.6rem;
    .ui-yen .price-symbol {
      font-family: arial;
      font-style: normal;
      font-size: 1.8rem;
      position: relative;
      top: 2px;
    }
    .ui-yen .price {
      font-size: 2.4rem;
      position: relative;
      top: 2px;
      margin-right: 0.5rem;
    }
    .icon-text {
      background-color: #fb6878;
      color: #fff;
      font-size: 1.2rem;
      padding: 1px 2px;
    }
  }
  .item-price {
    font-size: 1.2rem;
    height: 2rem;
    line-height: 2rem;
    color: #888;
    display: inline-block;
    margin-right: 1rem;
    font-family: "\5fae\8f6f\96c5\9ed1";
  }
}
.module-title .share-warp {
  padding: 3px 10px 0 !important;
  background-color: #fff;
}

.mui-flex {
  display: flex;
  -webkit-flex-wrap: wrap;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
}
.module-title .main {
  font-size: 1.4rem;
  color: #051b28;
  line-height: 2rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  max-height: 6.3rem;
  -webkit-box-orient: vertical;
  -webkit-box-pack: center;
  overflow: hidden;
  word-break: break-all;
}
.mui-flex > .cell {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
  width: 0;
  -webkit-flex-basis: 0;
  -ms-flex-preferred-size: 0;
  flex-basis: 0;
  max-width: 100%;
  display: block;
  padding: 0 !important;
  position: relative;
}
.module-adds {
  display: -webkit-box;
  display: flex;
  background-color: #fff;
  padding: 0.5rem 1rem;
  font-size: 1.2rem;
  color: #999;
  justify-content: space-between;
  //   span:first-child {
  //     text-align: left;
  //   }
  //   span:last-child {
  //     text-align: right;
  //   }
  //   span {
  //     -webkit-box-flex: 1;
  //     -webkit-flex: 1;
  //     flex: 1;
  //     text-align: center;
  //     overflow: hidden;
  //     text-overflow: ellipsis;
  //     white-space: nowrap;
  //     display: block;
  //   }
  .delivery {
    display: flex;
    img {
      width: 2rem;
    }
  }
}
.Spec {
  div {
    border: 1px solid;
  }
}
.details {
  margin-bottom: 5rem;
}
.mod_tab {
  display: flex;
  background: #fff;
  .item {
    flex: 1;
    height: 3.6rem;
    line-height: 2.2rem;
    padding-top: 1.5rem;
  }
  .item.cur {
    position: relative;
    font-weight: 700;
    color: #262626;
  }
  .item.cur:after {
    position: absolute;
    left: 50%;
    bottom: 6px;
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%);
    content: "";
    display: block;
    width: 2.6rem;
    height: 3px;
    background-image: -webkit-gradient(
      linear,
      left top,
      right top,
      from(#f5503a),
      to(#fad1cb)
    );
    background-image: -webkit-linear-gradient(left, #f5503a, #fad1cb);
    background-image: linear-gradient(90deg, #f5503a, #fad1cb);
  }
}
.wrapper {
  i {
    color: #fff;
    transform: translate3d(12rem, 20px, 0px) rotate3d(30, -24, 0, 180deg);
  }
  .sharetips{
      color: #fff;
    font-size: 2rem;
  }
}
</style>